package com.huan.spring6.aop.example;

//静态代理
public class CalculatorStaticProxy implements Calculator{
    //被代理对象目标传递过来
    private Calculator calculator;

    public CalculatorStaticProxy(Calculator calculator) {
        this.calculator = calculator;
    }

    @Override
    public int add(int i, int j) {
        //核心代码前 输出日志
        System.out.println("[日志] add 方法开始了，参数是：" + i + "," + j);
        //调用核心代码实现功能
        int addResult = calculator.add(i,j);
        //核心代码后 输出日志
        System.out.println("[日志] add 方法结束了，结果是：" + addResult);
        return 0;
    }

    @Override
    public int sub(int i, int j) {
        return 0;
    }

    @Override
    public int mul(int i, int j) {
        return 0;
    }

    @Override
    public int div(int i, int j) {
        return 0;
    }
}
